<template>
	<view class="content">
		<image class="logo" src="/static/logo.png"></image>
		<view class="text-area">
			<text class="title">{{title}}</text>
		</view>
		<view>HELLO</view>
		<button type="primary" open-type="getUserInfo">用户授权</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title: 'Hello'
			}
		},
		onLoad() {
			uni.request({
				url: 'http://localhost:90/hello',
				success(res) {
					console.log('success')
				},
				fail(res) {
					console.log('fail')
				}
			})
		},
		methods: {
			login() {
				uni.login({
					success(loginInfo) {
						uni.request({
							url: "http://localhost:90/open/user/wx/login",
							method: "GET",
							data: {
								code: loginInfo.code,
								clientId: "wxmp",
								clientSecret: "123456"
							},
							success(res) {
								console.log("login success: ", res)
							},
							fail(res) {
								console.log("login fail: ", res)
							}
						})
					}
				})
			}
		}
	}
</script>

<style>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.logo {
		height: 200rpx;
		width: 200rpx;
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}

	.text-area {
		display: flex;
		justify-content: center;
	}

	.title {
		font-size: 36rpx;
		color: #8f8f94;
	}
</style>
